/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ivanbiz.helper;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DateFormat;
import java.util.Date;
import java.util.TimeZone;
import javax.swing.JLabel;
import javax.swing.Timer;

/**
 *
 * @author Administrator
 */
public class DigiClock extends JLabel implements ActionListener {

    private DateFormat df = DateFormat.getTimeInstance();

    public DigiClock() {
        setHorizontalAlignment(JLabel.RIGHT);
        setFont(new Font("Verdana", Font.BOLD, 26));
        Timer tim = new Timer(1000, this);
        tim.start();
    }

    public DigiClock(String zone) {
        df.setTimeZone(TimeZone.getTimeZone(zone));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        setText(df.format(new Date()));
    }
}
